package com.jt.df.dubbo.demo.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.jt.df.dubbo.demo.domain.Demo;
import com.jt.df.dubbo.demo.mapper.DemoMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

@Service
public class DemoServiceImpl implements DemoService {

	static Logger logger = LoggerFactory.getLogger(DemoServiceImpl.class);

	@Autowired
	private DemoMapper demoMapper;
	
	public String sayHello(String name) {
		logger.info("Hello,{}",name);
		return "Hello,"+name;
	}

	public Demo get(Integer id) {
		return demoMapper.selectByPrimaryKey(id);
	}

	public Integer save(Demo demo) {
		return demoMapper.insert(demo);
	}

	public void update(Demo demo) {
		demoMapper.updateByPrimaryKeySelective(demo);
	}

	public void delete(Integer id) {
		demoMapper.deleteByPrimaryKey(id);
	}

}
